package com.topwater.topwater.service.impl;

import com.topwater.topwater.entity.UsUser;
import com.topwater.topwater.dao.UsUserDao;
import com.topwater.topwater.service.UsUserService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;

import javax.annotation.Resource;

/**
 * (UsUser)表服务实现类
 *
 * @author 胡文 qq:986776
 *自定义生成器制造
 */
@Service("usUserService")
public class UsUserServiceImpl  implements UsUserService {
    @Resource
    private UsUserDao usUserDao;

    /**
     * 通过ID查询单条数据
     *
     * @param userno 主键
     * @return 实例对象
     */
    @Override
    public UsUser queryById(String userno) {
        return this.usUserDao.queryById(userno);
    }

 
    /**
     * 新增数据
     *
     * @param usUser 实例对象
     * @return 实例对象
     */
    @Override
    public UsUser insert(UsUser usUser) {
        this.usUserDao.insert(usUser);
        return usUser;
    }
  @Override
    public UsUser insertNotNull(UsUser usUser) {
        this.usUserDao.insertNotNull(usUser);
        return usUser;
    }
    /**
     * 修改数据
     *
     * @param usUser 实例对象
     * @return 实例对象
     */
    @Override
    public UsUser update(UsUser usUser) {
        this.usUserDao.update(usUser);
        return this.queryById(usUser.getUserno());
    }

    /**
     * 通过主键删除数据
     *
     * @param userno 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String userno) {
        return this.usUserDao.deleteById(userno) > 0;
    }
    /**
    *字符串自动模糊查询
    **/
    public List<UsUser> queryByLike(UsUser usUser){
        return this.usUserDao.queryByLike(usUser);
    }
    
    public List<UsUser> queryByLike2(String str){
         return this.usUserDao.queryByLike2(str);
    }
    /**
    *多表连接查询
    */
    public List<Map> queryJoin(@Param("usUser")  UsUser usUser, @Param("tables") String... tables){
         return this.usUserDao.queryJoin(usUser,tables);
    }
}
